Skip to content

fix(rust): exclude observer work from local lookup duration - #279

Draft
lan17 wants to merge 1 commit into
mainfrom
fix/rust-local-get-metric-timing
Draft

lan17 wants to merge 1 commit into
mainfrom
fix/rust-local-get-metric-timing

Conversation

@lan17

@lan17 lan17 commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Problem

The Rust local cache read measures its duration after the synchronous Request observer returns. A slow observer therefore inflates Get duration. This was found with a local deterministic reproduction; no issue was filed.

Change

Capture the existing elapsed measurement immediately after local_get, before emitting Request and Get. Add a virtual-clock regression that advances time by 250 ms in the local request observer, then checks a miss and a later hit. Both values remain correct, and the source runs once.

This is a bug fix under the native X01 telemetry-timing boundary. It does not change a portable contract or reverse a design decision, so no design record or Quint change is needed. Event order, names, tags, units and synchronous observer delivery stay unchanged. The no-observer path has no added clock read or allocation.

Ports

Port Status
TypeScript N/A: Rust-native timer correction; no portable behavior change.
Go N/A: Rust-native timer correction; no portable behavior change.
Rust Fixed and covered by a deterministic miss/hit regression.
Python N/A: Rust-native timer correction; no portable behavior change.

Validation

Head: a02c9f9a9a1d93f891bd8e131a4268aad0ee70a2

The local test and independent review results below were run at 2c2dd5f. They are reused because the only later change removed a commit-message trailer; the full source tree is identical. The hosted checks below passed on the current head.

  • Regression added to base 22c1f502ddb5f27419faf5caa528d9ea3a9c92e4, before the source fix: failed as expected with durations [0.25, 0.25] instead of [0.0, 0.0]. Command from rust/: cargo test --locked --test metrics_exporters isolation::local_get_duration_excludes_request_observer_time -- --exact.
  • At the original tested commit, cargo test --locked --features prometheus --test metrics_exporters from rust/: passed, 7 tests.
  • At the original tested commit, make check-rust: passed, including formatting, both Clippy configurations and 210 tests. This command did not run 7 intentionally ignored tests.
  • At the original tested commit, make audit: passed.
  • Independent correctness, tests, simplicity, architecture, contracts, reliability, performance and two-stage combined review: no findings.
  • Rollout safety review: no blocking findings.
  • Hosted PR CI at the current head: passed, including CI, Formal smoke and all four differential shards, documentation build, PR title and CodeQL. Documentation deployment was skipped on the pull request.
  • Required formal-full.yaml run 43386609897, mutations mode, at the current head: passed. Corpus generation, symbolic checks, all four port replays, TypeScript/Go/Rust mutation campaigns, their merged reports and the final aggregate passed.
  • Obsolete formal-full.yaml run 43384729187 at the old head: cancelled after the metadata correction and not used as current-head evidence.

Not run: none required. Full model checks and fresh-seed exploration are outside this change's required Mutations tier.

Follow-ups

None.

@codecov-commenter

codecov-commenter commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.77%. Comparing base (22c1f50) to head (a02c9f9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #279   +/-   ##
=======================================
  Coverage   94.76%   94.77%           
=======================================
  Files          84       84           
  Lines       13168    13169    +1     
  Branches      805      805           
=======================================
+ Hits        12479    12481    +2     
+ Misses        623      622    -1     
  Partials       66       66           
Flag Coverage Δ
go 93.90% <ø> (+0.04%) ⬆️
python 93.60% <ø> (ø)
rust 94.78% <100.00%> (+<0.01%) ⬆️
typescript 97.21% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Capture the local lookup duration before invoking request observers. Add a deterministic regression for both the initial miss and a later hit.
@lan17
lan17 force-pushed the fix/rust-local-get-metric-timing branch from 2c2dd5f to a02c9f9 Compare November 13, 2026 07:27
@lan17
lan17 marked this pull request as ready for review November 13, 2026 08:38
@lan17
lan17 marked this pull request as draft November 13, 2026 08:44

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants